ToolUI

@Serializable
data class ToolUI(val toolCallId: String, val toolName: String, val state: ToolCallState, val input: JsonElement? = null, val output: JsonElement? = null, val error: String? = null, val preliminary: Boolean = false, val approvalId: String? = null, val signature: String? = null, val providerMetadata: Map<String, JsonElement>? = null) : UIMessagePart

One tool call's full lifecycle in the UI. State progresses InputStreaming → InputAvailable → OutputAvailable (or Error, or ApprovalRequired when the loop is paused on user decision). Component renderers can show the same card across states ("Looking up lineup..." → "Found 12 sets" → final card).

Per v6 naming: this is the equivalent of part.type === 'tool-X' in TypeScript. We discriminate on toolName string at the render site since Kotlin lacks TypeScript's literal-type narrowing.

Constructors

Link copied to clipboard
constructor(toolCallId: String, toolName: String, state: ToolCallState, input: JsonElement? = null, output: JsonElement? = null, error: String? = null, preliminary: Boolean = false, approvalId: String? = null, signature: String? = null, providerMetadata: Map<String, JsonElement>? = null)

Properties

Link copied to clipboard

Approval identity for ApprovalRequested/ApprovalResponded states — carried so a UI round-trip (convert to model messages, resume) preserves the approval's correlation key. Null outside the approval states. Mirrors v6's approval.id.

Link copied to clipboard
Link copied to clipboard
val input: JsonElement?
Link copied to clipboard
val output: JsonElement?
Link copied to clipboard

True when output is an intermediate snapshot from a streamingTool executor and a final value is still pending. False (default) for one-shot tool outputs and for the final emission from a streaming tool. UI uses this to show a "loading more" indicator on a still-incomplete card without collapsing back to InputAvailable. Mirrors v6's preliminary?: boolean on output-available.

Link copied to clipboard
val providerMetadata: Map<String, JsonElement>?
Link copied to clipboard

HMAC-SHA256 approval signature (v6.0.202, approval.signature). Must survive the UI round-trip untouched: with a configured approval secret, a replay missing it is denied fail-closed.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Functions

Link copied to clipboard
Link copied to clipboard